class Solution(object):
    def hIndex(self, citations):
        """
        :type citations: List[int]
        :rtype: int
        """
        citations.sort(reverse=True)
        n = len(citations)
        index = 0
        while index < n:
            if citations[index] < index + 1:
                return index
            index += 1
        return index



data = Solution()
citations = [3, 0, 6, 1, 5]
print(data.hIndex(citations))
